<script setup lang='ts'>
  import { reactive } from 'vue';
  import { propApi } from '@/api/controller';
  import { Toastloading } from '@/utils/public';
  import Pagination from "@/components/Pagination/index.vue";
  const action = reactive({
    dialogFormVisible:false,
    list:[] as any[],
    total:0,
    title:''
  })
  const listQuery = reactive({
    page:1,
    limit:20,
    stream_id:'',
  })
  const resetQuery = ()=>{
    listQuery.page = 1
    getList()
  }
  const openDialog = async(stream_id:any = 0)=>{
    if(!stream_id) return console.error('stream_id error')
    action.title = `参与记录流水明细id:${stream_id}`
    listQuery.stream_id = stream_id
    await getList()
    action.dialogFormVisible = true
  }
  const getList = async()=> {
    const loading = Toastloading()
    const res = await propApi.luckGiftDraInfoList(listQuery)
    loading.close()
    const { data=[], total=0 } = res.data || {}
    action.total = total
    action.list = data
  }
  defineExpose({
    openDialog
  })
</script>

<template>
  <el-dialog
    top="5vh"
    class="xm-dialog"
    v-model="action.dialogFormVisible"
    width="70%"
    :title="action.title">
    <el-table
      class="xm-main xm-TableCenter"
      :data="action.list"
      border
      show-summary>
      <el-table-column min-width="120" prop="draw_no" label="参与流水数" />
      <el-table-column min-width="120" prop="multiple_num" label="倍数" />
      <el-table-column min-width="120" prop="diamond_num" label="钻石数" />
      <el-table-column min-width="180" prop="created_at" label="时间" />
    </el-table>
    <Pagination v-show="action.total > 0" :total="action.total" v-model:page="listQuery.page"
      v-model:limit="listQuery.limit" @pagination="getList" />
  </el-dialog>
</template>
